<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>联盟云商圈</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">附近云商圈</h1>
		</header>
		<div class="mui-content fjysq_content">
			<div class="fjysq_lisbox">
				<div class="bt clearfix">
					<span class="left">名称</span>
					<span class="center">广告费</span>
					<span class="right">距离</span>
				</div>
				<ul class="fjsq_list">
					<!--<li class="clearfix">
						<a href="#">
							<span class="left">联盟一号</span>
							<span class="center">0.1元</span>
							<span class="right">500m</span>	
						</a>						
					</li>-->
				</ul>
				<button type="button" class="fjysq_btn" style="display: none;" id='crete_union'>创建联盟</button>
				<button type="button" class="fjysq_btn" style="display: none;" id='my_union'>我的联盟</button>
				<!--<button type="button" class="fjysq_btn" style="display: none;font-weight: bold;" disabled id='wait_union'>已申请联盟</button>-->
			</div>
		</div>
	</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/picker.js"></script>
<script type="text/javascript" src="../js/city.data-3.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script>
	var member = checkLogin(APP.web_root+"member/login.html");
	$(function(){
		var agent_id = localStorage.getItem('user_agent_id');
		$.ajax({
			url: APP.api_url + 'wallet/union_list_distance',
			data: {
				token: get_token(),
				uid: getUid()
			},
			success: function(data) {
				if(data.code == 200) {
					//检查当前店铺是否联盟成员
					$agent_info = data.data.agent_info;
					if($agent_info['is_union'] == 1){
						$('#crete_union').show();
					}else{
						$('#my_union').show();
					}
					var union_list = data.data.union_list;
					var union_htm='';
					for(var i =0 ;i<union_list.length;i++){
						var jl = union_list[i].juli;
						var unit='m';
						if(jl>1000){
							jl = jl/1000;
							unit = "km";
						}
						union_htm ="<li class='clearfix'><a href='fujinysq_show.html?union_id="+union_list[i].id+"'>"+
									"<span class='left'>"+union_list[i].name+"</span>"+
									"<span class='center'>"+union_list[i].unnion_ads_money+"元</span>"+
									"<span class='right'>"+jl+unit+"</span></a></li>";
						$('.fjsq_list').append(union_htm);
					}
				}else{
					$('#crete_union').show();
					layer.msg(data.msg);
				}
			}
		});
		$('#crete_union').click(function(){
			location.href = APP.web_root+'shopwallet/fujinysq_edit.html';
		})
		
		$('#my_union').click(function(){
			location.href = APP.web_root+'shopwallet/my_ysq.html';
		})
	})
</script>
